home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / prefs.dxr / 00028_Text & List Code.ls < prev    next >
Encoding:
Text File  |  2000-01-14  |  2.3 KB  |  108 lines

  1. global gDBTextVarList
  2.  
  3. on TextCopy
  4.   MyObj = getaProp(gDBTextVarList, GetObjProp())
  5.   xMember = the member of sprite getaProp(GetSpriteList(MyObj), #ts)
  6.   member("texthold f").text = char the selStart to the selEnd of the text of field xMember
  7.   copyToClipBoard(member("texthold f"))
  8. end
  9.  
  10. on EvalKeyPressed
  11.   if the commandDown then
  12.     case the key of
  13.       "c":
  14.     end case
  15.   else
  16.     beep()
  17.   end if
  18. end
  19.  
  20. on SetFieldProps xMember
  21.   set the textFont of member xMember to GetFont()
  22.   set the textSize of member xMember to 12
  23.   member(xMember).editable = 1
  24. end
  25.  
  26. on GetFont
  27.   if the machineType = 256 then
  28.     xFont = "arial"
  29.   else
  30.     xFont = "helvetica"
  31.   end if
  32.   return xFont
  33. end
  34.  
  35. on GetRectHeight xRect
  36.   return getAt(xRect, 4) - getAt(xRect, 2)
  37. end
  38.  
  39. on RemoveBlankLines xText
  40.   ReturnString = xText
  41.   LineMax = the number of lines in ReturnString
  42.   repeat with rc = LineMax down to 1
  43.     LineText = line rc of ReturnString
  44.     if (LineText = EMPTY) or (LineText = " ") then
  45.       delete line rc of ReturnString
  46.       LineMax = the number of lines in ReturnString
  47.     end if
  48.   end repeat
  49.   return ReturnString
  50. end
  51.  
  52. on ParseLineBreak xText
  53.   repeat while xText contains "^"
  54.     Pos = offset("^", xText)
  55.     put RETURN into char Pos of xText
  56.   end repeat
  57.   return xText
  58. end
  59.  
  60. on RectToLoc xRect
  61.   l = getAt(xRect, 1)
  62.   t = getAt(xRect, 2)
  63.   R = getAt(xRect, 3)
  64.   b = getAt(xRect, 4)
  65.   xPoint = point(((R - l) / 2) + l, ((b - t) / 2) + t)
  66.   return xPoint
  67. end
  68.  
  69. on CreateLookUpList paramList
  70.   list = []
  71.   repeat with rc in paramList
  72.     append(list, getPos(paramList, rc))
  73.   end repeat
  74.   return list
  75. end
  76.  
  77. on LineItemCount xText
  78.   storeDelimiter = the itemDelimiter
  79.   the itemDelimiter = TAB
  80.   xNumber = the number of items in xText
  81.   the itemDelimiter = storeDelimiter
  82.   return xNumber
  83. end
  84.  
  85. on BlankLine xText
  86.   return (xText = EMPTY) or (xText = " ")
  87. end
  88.  
  89. on RemoveSpaces xText
  90.   ReturnString = xText
  91.   repeat while ReturnString contains " "
  92.     SpaceLoc = offset(" ", ReturnString)
  93.     delete char SpaceLoc of ReturnString
  94.   end repeat
  95.   return ReturnString
  96. end
  97.  
  98. on DelBorderSpaces xText
  99.   ReturnString = xText
  100.   repeat while char 1 of ReturnString = " "
  101.     delete char 1 of ReturnString
  102.   end repeat
  103.   repeat while char length(ReturnString) of ReturnString = " "
  104.     delete char length(ReturnString) of ReturnString
  105.   end repeat
  106.   return ReturnString
  107. end
  108.